<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>过滤器</title>
    <link rel="stylesheet" href="../../public/base.css">
    <script src="../../public/angular.min.js"></script>
</head>
<body ng-app="myApp">
    <p title="currency:格式化数字为货币格式" ng-init="n=8500">
        {{n|currency}}
        {{n|currency:"人民币 ￥"}}
    </p>
    <p title="filter:过滤" ng-init="arrStr=['北京','websong','59124']">
        <input type="text" ng-model="t">
        <b ng-repeat="x in arrStr|filter:t">{{x}} </b>
    </p>
    <p title="uppercase，lowercase 大小写转换">
        {{ "lower cap string" | uppercase }}
        {{ "TANK is GOOD" | lowercase }}
    </p>
<p title="date 格式化">
    {{1490161945000 | date:"yyyy-MM-dd HH:mm:ss"}}
</p>
<p title="currency货币格式化">
    {{ 250 | currency }}
    {{ 250 | currency:"RMB ￥ " }}
</p>
<p title="limitTo 截取">
    {{"1234567890" | limitTo :6}} // 从前面开始截取6位
    {{"1234567890" | limitTo:-4}} // 从后面开始截取4位
</p>
<p title="orderBy 排序">
    // 根id降序排
    {{ [{"age": 20,"id": 10,"name": "iphone"},
    {"age": 12,"id": 11,"name": "sunm xing"},
    {"age": 44,"id": 12,"name": "test abc"}
    ] | orderBy:'id':true }}<br>
    // 根据id升序排
    {{ [{"age": 20,"id": 10,"name": "iphone"},
    {"age": 12,"id": 11,"name": "sunm xing"},
    {"age": 44,"id": 12,"name": "test abc"}
    ] | orderBy:'id' }}
</p>
<p title="自定义过滤器">
    <span ng-bind="'我是谁'|web"></span>
</p>
</body>
<script>
    var app=angular.module("myApp",[]);
    app.filter("web",function () {
        return function(text) {
            return text.split("").reverse().join("");
        }
    })
</script>
</html>